<div>
    <el-row :gutter="20">
        <el-col :span="5">
            <el-button type="primary"
                       v-if="needAdminRole"
                       @click="openFormWin">新建代理商</el-button></el-col>
        <el-col :span="15">
            生活号筛选：
            <el-select filterable v-model="srchLifeIds" multiple placeholder="请选择">
                <el-option
                        v-for="life in srchLifes"
                        :key="life.id"
                        :label="life.name"
                        :value="life.id">
                </el-option>
            </el-select>
            昵称：
            <el-input style="width: 150px" v-model="pageInfo.srch_LIKE_name" placeholder="昵称"></el-input>
            <el-button type="primary"  @click="initData">查询 </el-button>
        </el-col>
    </el-row>
    <el-row>
        <el-table
                :data="tableData"
                stripe
                border
                style="width: 100%;margin-top: 10px">
            <el-table-column
                    prop="account"
                    label="账号">
            </el-table-column>
            <el-table-column
                    prop="name"
                    label="昵称">
            </el-table-column>

            <el-table-column
                    prop="createBy.name"
                    label="创建者">
            </el-table-column>
            <el-table-column
                    prop="createTime"
                    label="创建时间">
            </el-table-column>
            <el-table-column
                    label="操作"
                    width="250">
                <template slot-scope="scope">
                    <el-button
                            @click="openDetails(scope.row)" type="text" size="small">查看详情</el-button>
                    <el-button
                            v-if="needAdminRole"
                            @click="updateUser(scope.row)" type="text" size="small">编辑信息</el-button>
                    <el-button
                            v-if="needAdminRole"
                            @click="openResetPwd(scope.row)" type="text" size="small">重置密码</el-button>
                    <el-button
                            v-if="needAdminRole"
                            @click="deleteUser(scope.row)" type="text" size="small">删除</el-button>
                </template>
            </el-table-column>
        </el-table>
    </el-row>
    <div class="marginT10 center">
            <el-pagination
                    background
                    layout="prev, pager, next"
                    @current-change="handleCurrentChange"
                    :page-size="pageInfo.pageSize"
                    :total="pageInfo.totalNum">
            </el-pagination>
        </div>
    <el-dialog title="新建代理商" :visible.sync="dialogFormVisible"  width="30%">
        <el-form :model="form">
            <el-form-item label="账号：" :label-width="formLabelWidth">
                <el-input v-model="form.account" autocomplete="off"></el-input>
            </el-form-item>
            <el-form-item label="昵称：" :label-width="formLabelWidth">
                <el-input v-model="form.name" autocomplete="off"></el-input>
            </el-form-item>
            <el-form-item label="密码：" :label-width="formLabelWidth">
                <el-input type="password" v-model="form.pwd" autocomplete="off"></el-input>
            </el-form-item>
            <el-form-item label="确认密码：" :label-width="formLabelWidth">
                <el-input type="password" v-model="form.pwdc" autocomplete="off"></el-input>
            </el-form-item>
            <el-form-item label="选择管理的生活号：" :label-width="formLabelWidth">
                <el-select v-model="checkedLifes" multiple clearable placeholder="请选择">
                    <el-option
                            v-for="l in allLifes"
                            :key="l.id"
                            :label="l.name"
                            :value="l.id">
                    </el-option>
                </el-select>
            </el-form-item>
        </el-form>
        <div slot="footer" class="dialog-footer">
            <el-button @click="dialogFormVisible = false">取 消</el-button>
            <el-button type="primary" @click="submitForm">确 定</el-button>
        </div>
    </el-dialog>

    <el-dialog title="编辑" :visible.sync="showEditWin"  width="30%">
        <el-form :model="editForm">
            <el-form-item label="账号：" :label-width="formLabelWidth">
                <el-input :disabled="true" v-model="editForm.account" autocomplete="off"></el-input>
            </el-form-item>
            <el-form-item label="昵称：" :label-width="formLabelWidth">
                <el-input v-model="editForm.name" autocomplete="off"></el-input>
            </el-form-item>
            <el-form-item label="选择管理的生活号：" :label-width="formLabelWidth">
                <el-select v-model="checkedLifes" multiple clearable placeholder="请选择">
                    <el-option
                            v-for="l in allEditLifes"
                            :key="l.id"
                            :label="l.name"
                            :value="l.id">
                    </el-option>
                </el-select>
            </el-form-item>
        </el-form>
        <div slot="footer" class="dialog-footer">
            <el-button @click="cancelEdit">取 消</el-button>
            <el-button type="primary" @click="submitEditForm">确 定</el-button>
        </div>
    </el-dialog>

    <el-dialog title="详情" :visible.sync="showDetailWin"  width="30%">
        <el-form :model="detailForm" :disabled="disableDetailForm">
            <el-form-item label="账号：" :label-width="formLabelWidth">
                <el-input v-model="detailForm.account" autocomplete="off"></el-input>
            </el-form-item>
            <el-form-item label="昵称：" :label-width="formLabelWidth">
                <el-input v-model="detailForm.name" autocomplete="off"></el-input>
            </el-form-item>
            <el-form-item label="创建时间：" :label-width="formLabelWidth">
                <el-input v-model="detailForm.createTime" autocomplete="off"></el-input>
            </el-form-item>
            <el-form-item label="创建人：" :label-width="formLabelWidth">
                <el-input v-model="detailForm.createBy.name" autocomplete="off"></el-input>
            </el-form-item>
            <el-form-item label="管理的生活号：" :label-width="formLabelWidth">
                <el-checkbox-group v-model="tempData">
                    <el-checkbox checked style="display: block"  v-for="l in checkedLifes" :label="l.id" :key="l.id">{{l.name}}</el-checkbox>
                </el-checkbox-group>
            </el-form-item>
        </el-form>

    </el-dialog>


    <el-dialog title="重置密码" :visible.sync="showResetPwdWin"  width="30%">
        <el-form :model="resetPwdForm">
            <el-form-item label="账号：" :label-width="formLabelWidth">
                <el-input :disabled="true" v-model="resetPwdForm.account" autocomplete="off"></el-input>
            </el-form-item>
            <el-form-item label="昵称：" :label-width="formLabelWidth">
                <el-input :disabled="true" v-model="resetPwdForm.name" autocomplete="off"></el-input>
            </el-form-item>
            <el-form-item label="新密码：" :label-width="formLabelWidth">
                <el-input type="password" v-model="resetPwdForm.pwd" autocomplete="off"></el-input>
            </el-form-item>
            <el-form-item label="确认密码：" :label-width="formLabelWidth">
                <el-input type="password" v-model="resetPwdForm.pwdc" autocomplete="off"></el-input>
            </el-form-item>
        </el-form>
        <div slot="footer" class="dialog-footer">
            <el-button @click="showResetPwdWin=false">取 消</el-button>
            <el-button type="primary" @click="resetPwd">确 定</el-button>
        </div>
    </el-dialog>
</div>